package abstractservlet;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import controllers.Autoservice;
import autoservice.api.controller.IAutoservice;


public abstract class AbstractServlet extends HttpServlet{
	/**
	 * 
	 */
	private static final long serialVersionUID = -8184559771862161515L;
	private static final String USER = "user";
	private static final String ANSWER = "answer";
	private IAutoservice autoservice = Autoservice.getInstance();
	
	
	public void navigate(HttpServletRequest request, HttpServletResponse response,String nameOperation,Object answer, String urlPage) throws ServletException, IOException{
		String login = (String) request.getSession().getAttribute(USER);
		autoservice.setOperation(login, nameOperation);
		request.setAttribute(ANSWER,answer);
		request.getRequestDispatcher(urlPage).forward(request, response);
		
	}

}
